﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.ResultFormat
{
    /// <summary>
    /// 分页数据获取
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class PageDataInfo<T>
    {
        /// <summary>
        /// 分页数据初始化
        /// </summary>
        /// <param name="data">当前页数据</param>
        /// <param name="pageIndex">第几页</param>
        /// <param name="pageSize">每页条数</param>
        public PageDataInfo(List<T> data, int pageIndex, int pageSize, int totalCount) 
        {
            Data = data;
            PageIndex = pageIndex;
            PageSize = pageSize;
            TotalCount = totalCount;
        }
        /// <summary>
        /// 无参初始化
        /// </summary>
        public PageDataInfo() 
        {
        
        }
        /// <summary>
        /// 当前页数据
        /// </summary>
        public List<T> Data { get; set; }
        /// <summary>
        /// 第几页
        /// </summary>
        public int PageIndex { get; set; } = 1;
        /// <summary>
        /// 每页条数
        /// </summary>
        public int PageSize { get; set; } = 10;
        /// <summary>
        /// 总条数
        /// </summary>
        public int TotalCount { get; set; }
    }
}
